<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="/management/css/css.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="/dwr/util.js"></script>
		<script type="text/javascript" src="/js/common/commanFunction.js"></script>
		<title>增加用户信息</title>
		<script type="text/javascript">
			function adduser(){
				if(!isLength("username",6,20,"用户名")){
					return false;
				}else if(!issuzm("username","用户名")){
					return false;
				}else if(!isLength("password",6,20,"密码")){
					return false;
				}else if(!issuzm("password","密码")){
					return false;
				}else if($("password").value != $("repassword").value ){
					alert("两次密码不相同！");
					$(repassword).focus();
					return false;
				}else if(!isLength("xingming",2,10,"用户名")){
					return false;
				}else{
					document.getElementById("userform").action="/management/user/saveuser.do";
	    	    	document.getElementById("userform").submit();
	    	    	return false;
				}
			}
			function issuzm(id,name){
			  var reg1 = /^[0-9a-zA-Z]+$/g;
					var str = $(id).value;
					var r1 = str.match(reg1);
					if(r1 == null){
						alert(name+"只能由字母和数字组成！");
						$(id).focus();
						return false;
					}
			   return true;
		}
		</script>
	</head>
	<body>
		<form action="" name="userform" id="userform" method="post">
			<table width="60%" align="center" style="border:solid 1px #000000"
				bgcolor="#3366FF" cellpadding="1" cellspacing="1">
				<tr bgcolor="#FFFFFF">
					<td align="center" colspan="3" class="title">
						<a href="/management/user/findusermanager.do">用户管理</a>&nbsp;&nbsp;
						添加用户
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="center" width="20%" class="boldfont">
						用户名
					</td>
					<td align="left" colspan="2" width="80%">
						<input type="text" name="username" id="username" value=""
							maxlength="20" />
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="center" width="20%" class="boldfont">
						用户密码
					</td>
					<td align="left" colspan="2" width="80%">
						<input type="password" name="password" id="password" value=""
							maxlength="20" />
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="center" width="20%" class="boldfont">
						重复密码
					</td>
					<td align="left" colspan="2" width="80%">
						<input type="password" name="repassword" id="repassword" value=""
							maxlength="20" />
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="center" width="20%" class="boldfont">
						用户姓名
					</td>
					<td align="left" colspan="2" width="80%">
						<input type="text" name="xingming" id="xingming" value=""
							maxlength="10" />
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="center" colspan="4">
						<input type="button" name="button1" value=" 提 交 "
							onclick="return adduser();" />
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="reset" name="reset1" value=" 重 置 " />
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
